<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {
	public function __construct()
	{
		parent::__construct();
		
		$this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT');
		$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
		$this->output->set_header('Cache-Control: post-check=0, pre-check=0',false);
		$this->output->set_header('Pragma: no-cache');
		$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
		
		#load all database and required models
		$this->load->database();
		$this->load->model('common_model');
		$this->data = array();
	}

	public function index()
	{
		$this->load->view('home');
	}
	
	public function pageNotFound()
	{
		$this->load->view('pageNotFound');
	}
	
	public function login()
	{
		if($this->session->userdata('logedin')){
			$type = $this->session->userdata('admin_type');
			if($type == 'Web Admin' || $type == 'Sub Admin')
			{
				$admin = 'admin';
			}
			else {
				$admin = 'panelist';
			}
			header('Location: '.BASE_URL.'/'.$admin.'/dashboard');
		}else{
//			$this->session->set_userdata('app_event_id',);
			$this->load->view('login');
		}
	}
	
	public function authenticate()
	{
		$this->data['post_value'] = $this->input->post();
		
		// Set validation rules.5
		$this->form_validation->set_rules('email', 'Email','trim|required|valid_email|xss_clean');
		$this->form_validation->set_rules('password', 'Password','trim|required');
		// Run the validation.
		if ($this->form_validation->run())
		{
			$login_details['email']=$this->input->post('email');
			$login_details['password']=md5($this->input->post('password'));
			if(!$this->common_model->checkLogin($login_details))
			{
				if($this->common_model->user_checkLogin($login_details))
				{
					$this->session->set_userdata('application_event_id',$this->input->post('app_event_id'));
					$this->session->set_userdata('application_award_id',$this->input->post('app_award_id'));
					if(($this->session->userdata('application_event_id')) && ($this->session->userdata('application_award_id'))){
						header('Location: '.BASE_URL . '/user/application_form?formID=' . $this->session->userdata('application_award_id') . '&type=new');
						exit();
						
					}else {
						header('Location: '.BASE_URL.'/user/dashboard');
						redirect(BASE_URL.'/user/dashboard');
						exit();
					}
					
				}
				else {
					$this->data['error']='Invalid Email / Password';
					$this->session->set_userdata('login_error', $this->data['error']);
					header('Location: '.BASE_URL.'/login');
					redirect(BASE_URL.'/login');
					exit();
				}
			}
			else
			{
				$type = $this->session->userdata('admin_type');
				if($type == 'Web Admin' || $type == 'Sub Admin')
				{
					$admin = 'admin';
				}
				else {
					$admin = 'panelist';
				}
				header('Location: '.BASE_URL.'/'.$admin.'/dashboard');
				redirect(BASE_URL.'/'.$admin.'/dashboard');
				exit();
			}
		}
		else
		{	
			$this->data['error'] = validation_errors();
			$this->data['error'] = 'Please enter valid credentials';
			$this->load->view('login', $this->data);
		}
	}
	
	public function dashboard($type)
	{
		$this->data['admin_value'] = $this->session->all_userdata();
		if($this->session->userdata('logedin')){
			$this->load->view('admin/dashboard', $this->data);
		}
		else{
			header('Location: '.BASE_URL.'/login');
			redirect(BASE_URL.'/login');
			exit();
		}
	}
	
	public function about_prospernet()
	{
		$this->load->view('about');
	}

	public function events($val='')
	{
		$this->load->view('events');
	}
	
	public function faq()
	{
		$this->load->view('faq');
	}
	
	public function about_elsevier()
	{
		$this->load->view('about1');
	}
	
	public function about_alexander_von_humboldt_foundation()
	{
		$this->load->view('about2');
	}
	
	public function contact_us(){
		if(isset($_POST['name'])){
			$this->form_validation->set_rules('name', 'Name','trim|required|regex_match[/^[A-Za-z\. ]+$/]|xss_clean');
			$this->form_validation->set_rules('email', 'Email','trim|required|valid_email');
			$this->form_validation->set_rules('message', 'Message','trim|required|regex_match[/^[A-Za-z0-9\.\,-\_\&\)(\ ]+$/]|xss_clean');
			if ($this->form_validation->run()){
				if($this->common_model->contact_us()){
					$config = Array(
					'protocol' => 'smtp',
					'smtp_host' => 'smtpout.asia.secureserver.net',
					'smtp_port' => 80,
					'smtp_user' => 'info.elsevier@logiquebraincreations.com',
					'smtp_pass' => 'default@123',
					'mailtype'  => 'html'
					);
					$this->load->library('email', $config);
					$this->email->set_newline("\r\n");
					$this->email->from('no-reply@elsevier.com', 'Elsevier');
					$this->email->to($this->input->post('email')); 
					$this->email->subject('Elsevier - Thank you for writing to us');
					$this->load->library('email',array('mailtype'=>'html'));
					$name = ucwords(strtolower($this->input->post('name')));
					
					$message='<!DOCTYPE html>
								<html>
								<head>
								<title>Elsevier</title>
								<meta charset="utf-8" />
								</head>
								<body style="margin:0px; padding:0px;">
								<table width="640" border="0" align="center" cellpadding="0" cellspacing="0"  style="background-color:#fafafa; border:1px solid #e1e1e1;">
								  <tr bgcolor="#FF8200">
									<td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									  <tr>
													<td bgcolor="#ff8200" style="font-family:Calibri; font-size:16px; color:#000000;"><a href="http://www.elsevier.co.in" target="_blank" style="text-decoration:none"><img src="'.ASSET_URL.'"images/elsevier.png" border="0" alt="Elsevier" style="display:block;" /></a></td>
											  </tr>
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									</table></td>
								  </tr>
									<tr>
										<td>
											<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#fafafa; margin:0 auto;">
											
												<tr>
													<td bgcolor="#fafafa">
														<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
														  <tr>
															  <td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
														  </tr>
															<tr>
																<td bgcolor="#FAFAFA" style="font-family:Calibri; font-size:16px; font-weight:bold; color:#333;">Dear '.ucwords($name).',</td>
															</tr>
														</table>
													</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333;">Thank you writing to us. We will get back to you shortly.</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
												  <td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;">Regards,<br />
													Elsevier Support</td>
												</tr>
												<tr>
										<td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
											</table>
									
										</td>
									</tr>
									<tr>
									  <td bgcolor="#FFFFFF"><table width="640" border="0" align="center" cellpadding="0" cellspacing="0" style="vertical-align:top;">
										<tr>
										  <td bgcolor="#232933"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											<tr>
											  <td valign="bottom" bgcolor="#232933" style="text-align:center;"><span style="font-size: 12px; font-family: Calibri; line-height: 17px; color: #ffffff; text-align: center;">Copyright &copy; 2015 Elsevier. All Rights Reserved </span></td>
											  </tr>
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											</table></td>
										</tr>
									  </table></td>
								  </tr>
								</table>
								</body>
								</html>
								';
					$this->email->message($message);
					$this->email->send();
					$this->session->set_userdata('contact_message','Thank you for writing to us. We will get back to you shortly.');
				}
			}
		}
		$this->load->view('contact_us');
	}
	
	public function forgot_password(){
		if(isset($_POST['email'])){
			$this->form_validation->set_rules('email', 'Email','trim|required|valid_email');
			if ($this->form_validation->run()){
			$data['query'] = $this->common_model->email_forgot();
			if($data['query'] != NULL){
				$reset_key = $data['query'][0]->user_reset_code;
				$name = $data['query'][0]->user_first_name.' ';
				if($data['query'][0]->user_middle_name!=' '){
					$name .= $data['query'][0]->user_middle_name.' ';
				}
				$name .= $data['query'][0]->user_last_name.' ';
					$config['protocol']='smtp';
			        $config['smtp_host']='smtpout.asia.secureserver.net';
			        $config['smtp_port']='80';
			        $config['smtp_timeout']='30';
			        $config['smtp_user']='info.elsevier@logiquebraincreations.com';
			        $config['smtp_pass']='default@123';
			        $config['charset']='utf-8';
			        $config['newline']="\r\n";
			        $config['wordwrap'] = TRUE;
			        $config['mailtype'] = 'html';
			        $this->email->initialize($config);
			        $this->email->from('no-reply@elsevier.com', 'Elsevier');
			        $this->email->to($this->input->post('email'));
			        $this->email->subject('Elsevier - Reset your password');
					$message =	'<!DOCTYPE html>
								<html>
								<head>
								<title>Elsevier</title>
								<meta charset="utf-8" />
								</head>
								
								<body style="margin:0px; padding:0px;">
								<table width="640" border="0" align="center" cellpadding="0" cellspacing="0"  style="background-color:#fafafa; border:1px solid #e1e1e1;">
								  <tr bgcolor="#FF8200">
									<td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									  <tr>
									  	<td bgcolor="#ff8200" style="font-family:Calibri; font-size:16px; color:#000000;"><a href="http://www.elsevier.co.in" target="_blank" style="text-decoration:none"><img src="'.ASSET_URL.'"images/elsevier.png" border="0" alt="Elsevier" style="display:block;" /></a></td>
									  </tr>
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									</table></td>
								  </tr>
									<tr>
										<td>
											<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#fafafa; margin:0 auto;">
											
												<tr>
													<td bgcolor="#fafafa">
														<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
														  <tr>
															  <td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
														  </tr>
															<tr>
																<td bgcolor="#FAFAFA" style="font-family:Calibri; font-size:16px; font-weight:bold; color:#333;">Dear '.$name.',</td>
															</tr>
														</table>
													</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333;">Password reset link for your account</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;">Please click on the  link below to reset your account password.</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;"><a href="'.BASE_URL.'/reset_password?key='.$reset_key.'" target="_blank" style="text-decoration:none; color:#ff8200;">Click here to reset your password</a></td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
												  <td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;">Regards,<br />
													Elsevier Support</td>
												</tr>
												<tr>
										<td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
											</table>
									
										</td>
									</tr>
									<tr>
									  <td bgcolor="#FFFFFF"><table width="640" border="0" align="center" cellpadding="0" cellspacing="0" style="vertical-align:top;">
										<tr>
										  <td bgcolor="#232933"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											<tr>
											  <td valign="bottom" bgcolor="#232933" style="text-align:center;"><span style="font-size: 12px; font-family: Calibri; line-height: 17px; color: #ffffff; text-align: center;">Copyright &copy; 2015 Elsevier. All Rights Reserved </span></td>
											  </tr>
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											</table></td>
										</tr>
									  </table></td>
								  </tr>
								</table>
								</body>
								</html>
								';
					  $this->email->message($message);
					if($this->email->send()) {
					
						$this->session->set_userdata('forgot_message','Password reset link has been sent to your email.');
					}
					else {
						$this->session->set_userdata('forgot_message','Problem in sending email. Please try again');
					}
			}else {
				$this->session->set_userdata('forgot_error','No account found with this Email.');
			}
			}
		}
		$this->load->view('forgot_password');
	}
	
	public function new_application(){
		if($this->input->get('event') && $this->input->get('award')){
			$application_event_id = base64_decode($this->input->get('event'));
			$application_award_id = base64_decode($this->input->get('award'));
			$this->session->set_userdata('application_event_id', $application_event_id);
			$this->session->set_userdata('application_award_id', $application_award_id);
		}
		
		$data = array();
		$data['result'] = $this->common_model->new_application_form();
		$this->load->model('user_model');
		$data['form_detail'] = $this->user_model->getFormData($this->session->userdata('application_award_id'));
			for( $j = 0; $j < count($data['result']); $j++){
			$i =  $data['result'][$j]->event_application_form_field_id;
			$data['result1'][$j] = $this->common_model->fecth_application_field_id($i);
		}
		$j = $j-1;
		$this->load->view('new_application',$data);
	}
	
	public function reset_key_check(){
		if($this->input->get('key')){
				$key = htmlspecialchars(strip_tags($this->input->get('key')),ENT_QUOTES);
				 $data['result'] = $this->common_model->reset_key_check($key);
				if($data['result']!=NULL){
					$user_id = $data['result'][0]->user_id;
					$name = $data['result'][0]->user_first_name.' ';
					if($data['result'][0]->user_middle_name!=' '){
						$name .= $data['result'][0]->user_middle_name.' ';
					}
					$name .= $data['result'][0]->user_last_name.' ';
					$email = $data['result'][0]->user_email;
					$this->reset_password($key,$user_id,$email,$name);
				}else {
					header('Location: '.BASE_URL.'/login');
					redirect(BASE_URL.'/login');
					exit();
				}
		}else {
			header('Location: '.BASE_URL.'/login');
			redirect(BASE_URL.'/login');
			exit();
		}
	}
	
	public function reset_password($key,$user_id,$email,$name){
		if(isset($_POST['npassword'])){
			
			$this->form_validation->set_rules('npassword', 'New Password','trim|required|min_length[6]|max_length[12]');
			$this->form_validation->set_rules('cpassword', 'Confirm Password','trim|required|min_length[6]|max_length[12]|matches[npassword]');
			if ($this->form_validation->run()){
				if($this->common_model->reset_password($user_id)){
					$this->session->set_userdata('reset_message','Password changed sucessfully');
					$config['protocol']='smtp';
			        $config['smtp_host']='smtpout.asia.secureserver.net';
			        $config['smtp_port']='80';
			        $config['smtp_timeout']='30';
			        $config['smtp_user']='info.elsevier@logiquebraincreations.com';
			        $config['smtp_pass']='default@123';
			        $config['charset']='utf-8';
			        $config['newline']="\r\n";
			        $config['wordwrap'] = TRUE;
			        $config['mailtype'] = 'html';
			        $this->email->initialize($config);
			        $this->email->from('no-reply@elsevier.com', 'Elsevier');
			        $this->email->to($email);
			        $this->email->subject('Elsevier - Password reset sucessfully');
					
					$message =	'<!DOCTYPE html>
								<html>
								<head>
								<title>Elsevier</title>
								<meta charset="utf-8" />
								</head>
								
								<body style="margin:0px; padding:0px;">
								<table width="640" border="0" align="center" cellpadding="0" cellspacing="0"  style="background-color:#fafafa; border:1px solid #e1e1e1;">
								  <tr bgcolor="#FF8200">
									<td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									  <tr>
													<td bgcolor="#ff8200" style="font-family:Calibri; font-size:16px; color:#000000;"><a href="http://www.elsevier.co.in" target="_blank" style="text-decoration:none"><img src="'.ASSET_URL.'"images/elsevier.png" border="0" alt="Elsevier" style="display:block;" /></a></td>
											  </tr>
									  <tr>
										<td height="20" bgcolor="#ff8200"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
									</table></td>
								  </tr>
									<tr>
										<td>
											<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#fafafa; margin:0 auto;">
											
												<tr>
													<td bgcolor="#fafafa">
														<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
														  <tr>
															  <td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
														  </tr>
															<tr>
																<td bgcolor="#FAFAFA" style="font-family:Calibri; font-size:16px; font-weight:bold; color:#333;">Dear '.$name.',</td>
															</tr>
														</table>
													</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333;">Password reset sucessfully for your account</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
													<td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;">Please <a href="'.BASE_URL.'">login</a> to continue.</td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
												  <td height="30" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
												</tr>
												<tr>
												  <td bgcolor="#fafafa" style="font-family:Calibri; font-size:16px; color:#333; text-align:justify;">Thanks,<br />
													Scopus Awards</td>
												</tr>
												<tr>
										<td height="50" bgcolor="#FAFAFA"><span style="background-color:#fff;"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></span></td>
									  </tr>
											</table>
									
										</td>
									</tr>
									<tr>
									  <td bgcolor="#FFFFFF"><table width="640" border="0" align="center" cellpadding="0" cellspacing="0" style="vertical-align:top;">
										<tr>
										  <td bgcolor="#232933"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											<tr>
											  <td valign="bottom" bgcolor="#232933" style="text-align:center;"><span style="font-size: 12px; font-family: Calibri; line-height: 17px; color: #ffffff; text-align: center;">Copyright &copy; 2015 Elsevier. All Rights Reserved </span></td>
											  </tr>
											<tr>
											  <td height="20" bgcolor="#232933"><img style="display:block;" src="'.ASSET_URL.'"images/spacer.gif" alt="" width="1" height="1" border="0" /></td>
											  </tr>
											</table></td>
										</tr>
									  </table></td>
								  </tr>
								</table>
								</body>
								</html>
								';
					
					$this->email->message($message);
					$this->email->send();
					$this->session->set_userdata('message','Your password reset sucessfully');
					header('Location: '.BASE_URL.'/login');
					redirect(BASE_URL.'/login');
					exit();
				}
				else {
					$this->session->set_userdata('reset_error','Password not changed sucessfully! Please try again');
				}
			}
		}
		$this->load->view('reset_password');
	}
	
	public function logOut()
	{
		$this->session->sess_destroy();
		header('Location: '.BASE_URL.'/login');
		redirect(BASE_URL.'/login');
		exit();
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
?>